package nsum;


/*
 * https://leetcode.cn/problems/two-sum/
 */
public class _1_两数之和 {

    public int[] twoSum(int[] nums, int target) {
        int[] result = new int[2];
        for (int i = 0; i < nums.length; i++) {
            int a = nums[i];
            int b = target - a;
            for (int j = i + 1; j < nums.length; j++) {
                if (b == nums[j]) {
                    result[0] = i;
                    result[1] = j;
                    break;
                }
            }

        }
        return result;
    }
}
